import { createApp } from "vue";
import store from "./pinia/index";
import router from "./router/index";
import App from "./App.vue";
import "viewerjs/dist/viewer.css";
import VueViewer from "v-viewer";
// elementui Icons
import elementPlusIconsPlugin from "@/utils/element-plus-icons";

// 解决报错-[Violation] Added non-passive event listener
import "default-passive-events";

// threejs
import * as THREE from "three";

// 样式风格统一
import "/src/assets/css/my-element-plus.css";
import "/src/assets/css/style.css";
import "/src/utils/reset-el-default.js";
import mitt from "mitt"; // 导入mitt

//引入dayjs日期插件
import dayjs from "dayjs";

import { havePermission } from "./assets/js/utils";
import Particles from "particles.vue3";
import vue3SeamlessScroll from "vue3-seamless-scroll";
import "@layui/layer-vue/lib/index.css";
import layui from "@layui/layui-vue";
import elTableInfiniteScroll from "el-table-infinite-scroll";

// 防止多次点击
import { directive } from "./common/utils/utils";
const app = createApp(App);
app.config.globalProperties.$mitt = new mitt();
app.config.globalProperties.$havePermission = havePermission;

//全局使用dayjs
app.config.globalProperties.$dayjs = dayjs;

let $httpUrl = import.meta.env.VITE_API_BASEURL;
app.config.globalProperties.$httpUrl = $httpUrl;
app.config.globalProperties.$httpUrl2 = "/public";
app.use(store);
app.use(directive);
app.use(layui);
app.use(Particles);
app.use(vue3SeamlessScroll);
app.use(elTableInfiniteScroll);
app.use(VueViewer, {
  defaultOptions: {
    zIndex: 3000,
    inline: false, // Default: false. Enable inline mode.
    button: true, // Show the button on the top-right of the viewer.
    navbar: true, // Specify the visibility of the navbar.
    title: false, // Specify the visibility and the content of the title.
    toolbar: false, // Specify the visibility and layout of the toolbar its buttons.
    tooltip: true, // Show the tooltip with image ratio (percentage) when zooming in or zooming out.
    movable: true, // Enable to move the image.
    zoomable: true, // Enable to zoom the image.
    rotatable: false, // Enable to rotate the image.
    scalable: true, // Enable to scale the image.
    transition: true, // Enable CSS3 Transition for some special elements.
    fullscreen: false, // Enable to request full screen when play.
    keyboard: true, // Enable keyboard support.
    url: "src", // Default: 'src'. Define where to get the original image URL for viewing.
  },
});
app.use(router);
app.use(elementPlusIconsPlugin);
app.mount("#app");
